import time
import subprocess


# def cmd(command):
# subp = subprocess.Popen(command)
#     # subp.wait(20)
#     if subp.poll() == 0:
#         print(subp.communicate()[1])
#     else:
#         print("失败")



# cmd("mitmweb -s midproxy_demo.py")
# cmd("exit 1")
cmd = 'mitmweb -s midproxy_demo.py'
# 开始进程
subp = subprocess.Popen(cmd)
# print(subp.communicate())

time.sleep(60)
# 关闭
subp.kill()
# subprocess.call(cmd)
# subprocess.
# os.system(cmd)
# time.sleep(20)
#
# cmd = 'mitmdump -s midproxy_demo.py'
